package com.share.bean.attach.advertise;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.share.commons.enumeration.AdvertisEnum;

/**
 * 说明：广告详细列表
 * <br/>编写者：杨浩泉
 * <br/>日期：2010-3-1
 */
@Entity
@Table(name = "share_advertise")
public class Advertise {

	/** 广告编号 */
	private int adId;

	/** 广告名称 */
	private String adName;

	/** 广告类型 */
	private AdvertisEnum adType = AdvertisEnum.PICTURE;

	/**
	 * 版位按权重（优先级、随机）显示时， 此处设置的权重越大， 该广告显示的机会就越多
	 */
	private int adWeight;

	/** 统计点击数 */
	private int adTotalClick;

	/** 统计浏览数 */
	private int adTotalBrowse;

	/** 广告过期时间 */
	private Date adExpireDate;

	/** 广告添加时间 */
	private Date adAddDate;

	/** 广告列表与版位列表多对一关联关系 */
	private PositionItem positionItem;

	/** 广告列表与广告文本内容 一对一关联关系 */
	private AdvertiseContext adContext;

	/** 广告列表与广告多媒体内容 一对一关联关系 */
	private AdvertiseMultimedia adMultimedia;

	@OneToOne(cascade = CascadeType.ALL, optional = true)
	@JoinColumn(name = "adMultimedia_id")
	public AdvertiseMultimedia getAdMultimedia() {
		return adMultimedia;
	}

	public void setAdMultimedia(AdvertiseMultimedia adMultimedia) {
		this.adMultimedia = adMultimedia;
	}

	@OneToOne(cascade = CascadeType.ALL, optional = true)
	@JoinColumn(name = "adContext_id")
	public AdvertiseContext getAdContext() {
		return adContext;
	}

	public void setAdContext(AdvertiseContext adContext) {
		this.adContext = adContext;
	}

	@ManyToOne
	@JoinColumn(name = "pi_ad_id")
	public PositionItem getPositionItem() {
		return positionItem;
	}

	public void setPositionItem(PositionItem positionItem) {
		this.positionItem = positionItem;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.TABLE)
	public int getAdId() {
		return adId;
	}

	public void setAdId(int adId) {
		this.adId = adId;
	}

	public String getAdName() {
		return adName;
	}

	public void setAdName(String adName) {
		this.adName = adName;
	}

	@Enumerated(EnumType.STRING)
	public AdvertisEnum getAdType() {
		return adType;
	}

	public void setAdType(AdvertisEnum adType) {
		this.adType = adType;
	}

	public int getAdWeight() {
		return adWeight;
	}

	public void setAdWeight(int adWeight) {
		this.adWeight = adWeight;
	}

	public int getAdTotalClick() {
		return adTotalClick;
	}

	public void setAdTotalClick(int adTotalClick) {
		this.adTotalClick = adTotalClick;
	}

	public int getAdTotalBrowse() {
		return adTotalBrowse;
	}

	public void setAdTotalBrowse(int adTotalBrowse) {
		this.adTotalBrowse = adTotalBrowse;
	}

	public Date getAdExpireDate() {
		return adExpireDate;
	}

	public void setAdExpireDate(Date adExpireDate) {
		this.adExpireDate = adExpireDate;
	}

	public Date getAdAddDate() {
		return adAddDate;
	}

	public void setAdAddDate(Date adAddDate) {
		this.adAddDate = adAddDate;
	}

}
